package com.gyul.findmystock.entity;

import java.io.Serializable;

public class TradeEntity implements Comparable<TradeEntity> , Serializable {
	private static final long serialVersionUID = 8541339270528889943L;
	
	public String symbol;
	public String name;
	public int price;
	public int count;
	public int goalPrice;
	
	public TradeEntity() {
		symbol = name = null;
		
	}
	
	public TradeEntity(String symbol, String name, int price, int count, int goalPrice) {
		this.symbol = symbol;
		this.name = name;		
		this.price = price;
		this.count = count;
		this.goalPrice = goalPrice;
	}
	
	@Override
	public int compareTo(TradeEntity company) {
		int result = symbol.compareTo(company.symbol);
		if ( result == 0 ) {
			return price - company.price;
		} else {
			return result;
		}
	}	
	
	@Override
	public String toString() {		
		return name + " - " + symbol + " Price : " + price;
	}
}
